﻿
@model Common.Param_StrategType

<html>
<head>
    <meta charset="utf-8">
    <title>攻略分类</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="https://cdn.staticfile.org/layui/2.7.6/css/layui.css" rel="stylesheet">
    <link rel="stylesheet" href="/Content/layuiadmin/style/admin.css" media="all">
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-container">
            <div class="layui-row">
                <div class="layui-col-xs10 layui-col-xs-offset1">
                    <form class="layui-form" style="margin-right:60px;" lay-filter="form" onsubmit="return false">
                        <div class="layui-form-item">
                            <label for="STypeName" class="layui-form-label">攻略分类名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="STypeName" id="STypeName" required lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input"value="@Model.STypeName">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label for="STPower" class="layui-form-label">等级</label>
                            <div class="layui-input-block">
                                <select name="STPower" id="STPower" lay-verify="required">
                                    <option value="1" @(Model.STPower == 1 ? "selected" : "")>1</option>
                                    <option value="2" @(Model.STPower == 2 ? "selected" : "")>2</option>
                                    <option value="3" @(Model.STPower == 3 ? "selected" : "")>3</option>
                                    <option value="4" @(Model.STPower == 4 ? "selected" : "")>4</option>
                                    <option value="5" @(Model.STPower == 5 ? "selected" : "")>5</option>
                                    <option value="6" @(Model.STPower == 6 ? "selected" : "")>6</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label for="Show" class="layui-form-label">是否显示</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="Show" id="Show" lay-skin="switch" value="@Model.Show">
                            </div>
                        </div>




                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn sub" lay-submit lay-filter="formDemo">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <script src="https://cdn.staticfile.org/layui/2.7.6/layui.js"></script>
    <script>
        layui.config({
            base: '/Content/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'set']);
    </script>

    <script src="~/Scripts/jquery-3.3.1.min.js"></script>
    <script src="~/Scripts/dist/html5ImgCompress.min.js"></script>
    <script src="~/Scripts/tools.js"></script>
    <script>
        var data = {};

        //Demo
        $(function () {
            layui.use(function () {

                var form = layui.form;
                form.on('submit(form)', function () {
                   
                    var index = layer.load(1, { shade: [0.6, "#fff"] });

                    data.STypeName = $("#STypeName").val();
                    data.Show = $("#Show").prop("checked");
                    data.STPower = $("#STPower").val();;
                  

                    console.log(data);
                    $.post(apiurl + "api/StrategType/Update/"+@Model.STypeID, data, function (res) {
                        console.log(res);
                        if (res.Code == 200) {
                            setTimeout(() => {
                                layer.close(index);
                                layer.msg("编辑成功", { icon: 6, time: 1500 });
                                setTimeout(() => {
                                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                                    parent.location.reload();
                                }, 600)
                            }, 300);
                        }
                        else {
                            layer.msg("编辑失败", { icon: 5, anim: 6, time: 1500 });
                        }
                    })
                });

                

            });
        })

    </script>

</body>
</html>











